package gaileenchess.tests;
import gaileenchess.*;

public abstract class Test
{
    public final String testType;
    
    public Test(String type)
    {
        this.testType = type;
    }
    
    public boolean run()
    {
        boolean pass = doTests();
        printSuccess(pass, "test", 1);
        return pass;
    }
    
    protected abstract boolean doTests();
    
    protected void printSuccess(boolean pass, String testName)
    {
        printSuccess(pass, testName, 0);
    }
    
    protected void printSuccess(boolean pass, String testName, int numTabs)
    {
        for(int x = 0; x < numTabs; x++)
        {
            System.out.print('\t');
        }
        
        if(pass)
        {
            System.out.println(this.testType + " " + testName + " successful!");
        }
        else
        {
            System.out.println(this.testType + " " + testName + " FAILED!");
        }
    }
}
